﻿@{
    ViewBag.Title = "AddNewSite";
}

<script src="@Url.Content("~/Scripts/rx.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/rx.jquery.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Markdown.Converter.js")") type="text/jscript"></script>
<script src="@Url.Content("~/Scripts/Markdown.Editor.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/Markdown.Sanitizer.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/site.js")" type="text/javascript"></script>


<script type="text/jscript">
	$(function () {
		var mdText = $("#mdText");
		var mdFormatted = $("#mdFormatted");
		function setFormatted(data) {
			mdFormatted.html(data);
		};
		mdText.toObservable("keypress")
		.Throttle(200)
		.Subscribe(function () {
			$.getJSON("@VirtualPathUtility.ToAbsolute("~/Util/FormatMarkdown/")", { 
				 markdownText: mdText.val() 
				}, setFormatted);
		})
</script>

<script type="text/jscript">
    /*
    var converter = new Markdown.Converter();
    document.write(converter.makeHTML("**I am bold!**"));
    */
</script>
@using (Html.BeginForm()) {  
     <fieldset>
         <div class="editor-label"> 
             @Html.Label("lblSite", "Site Title:")
         </div> 
         <div class="editor-field"> 
             @Html.TextBox("txtSite", "")
         </div> 
         <div class="editor-label"> 
             @Html.Label("lblUrl", "Site URL:")
         </div> 
         <div class="editor-field"> 
             @Html.TextBox("txtUrl", "")
         </div> 
         <div class="wmd-panel">
            <div id="wmd-button-bar"></div>
            <textarea class="wmd-input" id="wmd-input">
</textarea>
        </div>
        <div id="wmd-preview" class="wmd-panel wmd-preview"></div>
        




        <script type="text/javascript">
            (function () {
                var converter1 = Markdown.getSanitizingConverter();
                var editor1 = new Markdown.Editor(converter1);
                editor1.run();
            })();
        </script>
        <br />
        <div>
            <input id="markdownSubmit" type="submit" value="Submit" />
        </div>
        
     </fieldset>
    }
